/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jserver.tools;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ASUS
 *
 */
public class test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		final Map<String, String> testMap = new HashMap<String, String>();
		//final List<String> testlist = new ArrayList<>();
		
		testMap.put(String.valueOf(100000), "t_88888");
		new Thread(){

			@Override
			public void run() {
				for(int i=0;i<100000000;i++){
					if(i == 100000)
						continue;
					testMap.put(String.valueOf(i), "t_"+String.valueOf(i));
					//testlist.add("t_"+String.valueOf(i));
				}
			}
			
		}.start();
		
		new Thread(){

			@Override
			public void run() {
				for(int i=0;i<100000000;i++){
					if(i == 100000)
						continue;
					testMap.put(String.valueOf(i), "t_"+String.valueOf(i));
					//testlist.add("t_"+String.valueOf(i));
				}
			}
			
		}.start();
		

		
		for(int it=0;it<10;it++){
			new Thread(){

				@Override
				public void run() {
					String pre = null;
					for(int i=0;i<50000000;i++){
						int sz = testMap.size();
						String st = testMap.get(String.valueOf(100000));
						
//						int sz = testlist.size();
//						System.out.println("sz:" + String.valueOf(sz));
						
//						if(st == null)
//							st = "";
//						else{
//							pre = st;
//						}
						System.out.println("sz:" + String.valueOf(sz)
								+ " val:" + st);
						if(pre!=null && pre.equals(st)==false){
							System.out.println("no same");
							pre = null;
						}
						try {
							sleep(50);
						} catch (InterruptedException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
					}
				}
				
			}.start();
		}
		
	}

}
